package org.hyf.inspur.LessonDesin.clear.count8;

import org.hyf.inspur.LessonDesin.clear.tools.TProperties;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class PreUsersMapper extends Mapper<LongWritable,Text,Text, IntWritable> {
    protected void map(LongWritable key, Text value,
                       Mapper<LongWritable, Text, Text, IntWritable>.Context context)
            throws IOException, InterruptedException {
        String temp[]=value.toString().split(TProperties.getValue("fileoutsplit"));
        int num=0;
        int flag = Integer.parseInt(temp[4]);
        if(flag == 1){
            num = 1;
            context.write(new Text(temp[1]),new IntWritable(num));
        }
        if(flag == 2){
            num = 2;
            context.write(new Text(temp[1]),new IntWritable(num));
        }

    }
}
